package avicit.bdp.dds.dao.mapper;

import avicit.bdp.common.base.BaseDAO;
import avicit.bdp.dds.dao.entity.ProcessInstanceMap;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * process instance map mapper interface
 */
public interface ProcessInstanceMapMapper extends BaseDAO<ProcessInstanceMap> {

    /**
     * query process instance by parentId
     * @param parentProcessId parentProcessId
     * @param parentTaskId parentTaskId
     * @return process instance map
     */
    ProcessInstanceMap queryByParentId(@Param("parentProcessId") String parentProcessId,
                                       @Param("parentTaskId") String parentTaskId);


    /**
     * query by sub process id
     * @param subProcessId subProcessId
     * @return process instance map
     */
    ProcessInstanceMap queryBySubProcessId(@Param("subProcessId") String subProcessId);

    /**
     * delete by parent process id
     * @param parentProcessId parentProcessId
     * @return delete result
     */
    int deleteByParentProcessId(@Param("parentProcessId") String parentProcessId);

    /**
     *  query sub process instance  ids by parent instance id
     * @param parentInstanceId parentInstanceId
     * @return sub process instance ids
     */
    List<String> querySubIdListByParentId(@Param("parentInstanceId") String parentInstanceId);

}
